use crate::database::RedisPool;
use core::fmt::Debug;
use sea_orm::DatabaseConnection;

#[derive(Clone)]
pub struct AppState {
    pub db_conn: DatabaseConnection,
    pub redis_conn_pool: RedisPool,
}

impl Debug for AppState {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        let redis_m = self.redis_conn_pool.manager();
        let redis_pool_status = self.redis_conn_pool.status();

        f.debug_struct("AppState")
            .field("db_conn", &self.db_conn)
            .field("redis_conn_pool_manager", redis_m)
            .field("redis_conn_pool_status", &redis_pool_status)
            .finish()
    }
}
